/***************************************************************************

	Incredible Technologies/Strata system
	(8-bit blitter variant)

    driver by Aaron Giles

    Games supported:
		* Strata Bowling [2 sets]
		* Super Strike Bowling
		* Wheel of Fortune [2 sets]
		* Golden Tee Golf
		* Golden Tee Golf II [3 sets]
		* Slick Shot [2 sets]
		* Dyno-Bop
		* Arlington Horse Racing
		* Neck & Neck
		* Peggle [2 sets]
		* Hot Shots Tennis [2 sets]
		* Rim Rockin' Basketball [4 sets]
		* Ninja Clowns

	Dumps still needed:
		* Poker Dice

	Known issues:
		* The credits screen in Peggle shows for less than half the time
		  it should
		* Rim Rockin' Basketball should use an HD6309, but that core is
		  broken, so we're using the 6809 for now
		* Ninja Clowns main ROM dump claims it's bad
		* Super Strike Bowling/Dyno-Bop input doesn't work

****************************************************************************

	Memory map

****************************************************************************

	========================================================================
	CPU #1 (6809 games)
	========================================================================
	Note that many games have the regions 0000-0FFF and 1000-1FFF swapped.
	Also, Golden Tee Golf II (V2.2) has most of the addresses in the
	0000-0FFF range swizzled randomly.
	========================================================================
	0100          W   xxxxxxxx    Unknown
	0120          W   xxxxxxxx    Sound data
	0140        R     xxxxxxxx    Input port
	0140          W   xxxxxxxx    GROM blitter bank select
	0160        R     xxxxxxxx    Input port
	0160          W   xx------    Display page select
	              W   x-------       (upper page select)
	              W   -x------       (unknown)
	0180        R     xxxxxxxx    Input port/DIP switches
	0180          W   xxxxxxxx    Video RAM upper data latch
	01A0          W   --------    NMI acknowledge (on some boards)
	01C0-01C1   R/W   xxxxxxxx    Blitter chip address high
	01C2-01C3   R/W   xxxxxxxx    Blitter chip address low
	01C4-01C5   R/W   ---xxxxx    Blitter chip flags
	            R/W   ---x----       (render transparent)
	            R/W   ----x---       (expand RLE compressed data)
	            R/W   -----x--       (flip vertically)
	            R/W   ------x-       (flip horizontally)
	            R/W   -------x       (shift data left 4 bits)
	01C6-01C7   R     x-------    Blitter chip status (1=busy)
	01C6-01C7     W   --------    Blitter chip trigger
	01C8-01C9   R/W   xxxxxxxx    Blitter chip source width
	01CA-01CB   R/W   xxxxxxxx    Blitter chip source height
	01CC-01CD   R/W   xxxxxxxx    Blitter chip source data mask
	01CE-01CF   R/W   xxxxxxxx    Blitter chip output port
	              W   --x-----       (main program ROM bank select)
	01D0-01D1   R/W   xxxxxxxx    Blitter chip X starting coordinate
	01D2-01D3   R/W   xxxxxxxx    Blitter chip maximum scanline count
	01D4-01D5   R/W   xxxxxxxx    Blitter chip X ending coordinate
	01D6-01D7   R/W   xxxxxxxx    Blitter chip initial scanline skip
	01D8-01DF   R     xxxxxxxx    Blitter chip input ports
	01E0          W   xxxxxxxx    Palette address latch
	01E2-01E3     W   --xxxxxx    Palette data latches
	1000-11FF   R/W   xxxxxxxx    TMS34061 register access
	1200-13FF   R/W   xxxxxxxx    TMS34061 XY addressing access
	1400-15FF   R/W   xxxxxxxx    TMS34061 register access
	1600-17FF   R/W   xxxxxxxx    TMS34061 direct access
	1800-19FF   R/W   xxxxxxxx    TMS34061 shift register read
	1A00-1BFF   R/W   xxxxxxxx    TMS34061 shift register write
	2000-3FFF   R/W   xxxxxxxx    RAM (battery-backed)
	4000-7FFF   R     xxxxxxxx    Banked program ROM
	8000-FFFF   R     xxxxxxxx    Fixed program ROM
	========================================================================
	Interrupts:
		NMI generated by VBLANK
		IRQ generated by TMS34061 scanline interrupt
		FIRQ generated by blitter when finished
	========================================================================

	========================================================================
	CPU #1 (68000 games)
	========================================================================
	000000-003FFF   R/W   xxxxxxxx xxxxxxxx   RAM (battery-backed)
	004000-03FFFF   R     xxxxxxxx xxxxxxxx   Main program ROM
	100080          W     xxxxxxxx --------   Sound data
	100100          R     xxxxxxxx --------   Input port
	100100            W   xxxxxxxx --------   GROM blitter bank select
	100180          R     xxxxxxxx --------   Input port
	100100            W   xx------ --------   Display page select
	                  W   x------- --------       (upper page select)
	                  W   -x------ --------       (unknown)
	100240            W   xxxxxxxx --------   Video RAM upper data latch
	100280          R     xxxxxxxx --------   Input port/DIP switches
	100280            W   -------- --------   Unknown
	100300-10031F   R/W   xxxxxxxx xxxxxxxx   Blitter chip (as above)
	100380            W   xxxxxxxx --------   Palette address latch
	1003a0            W   --xxxxxx --------   Palette data latches
	110000-1101FF   R/W   xxxxxxxx xxxxxxxx   TMS34061 register access
	110200-1103FF   R/W   xxxxxxxx xxxxxxxx   TMS34061 XY addressing access
	110400-1105FF   R/W   xxxxxxxx xxxxxxxx   TMS34061 register access
	110600-1107FF   R/W   xxxxxxxx xxxxxxxx   TMS34061 direct access
	110800-1109FF   R/W   xxxxxxxx xxxxxxxx   TMS34061 shift register read
	110A00-110BFF   R/W   xxxxxxxx xxxxxxxx   TMS34061 shift register write
	========================================================================
	Interrupts:
		INT 3 generated by VBLANK
		INT 2 generated by blitter when finished
		INT 1 generated by ???
	========================================================================

	========================================================================
	CPU #2
	========================================================================
	0000          W   xxxxxxxx    Unknown
	1000        R     xxxxxxxx    Sound command input
	2000-2003   R/W   xxxxxxxx    Yamaha chip I/O
	3000-37FF   R/W   xxxxxxxx    RAM
	4000        R/W   xxxxxxxx    OKI 6295 I/O
	5000-5003   R/W   xxxxxxxx    6521 PIA chip (on early YM3812 boards)
	5000-500F   R/W   xxxxxxxx    6522 VIA chip (on later YM3812 boards)
	8000-FFFF   R     xxxxxxxx    Program ROM
	========================================================================
	Interrupts:
		NMI not connected
		IRQ generated by write to sound command input
		FIRQ generated by Yamaha chip, or by 6522 VIA (if present)
	========================================================================

***************************************************************************/


#include "driver.h"
#include "cpu/m6809/m6809.h"
#include "machine/6821pia.h"
#include "machine/ticket.h"
#include "vidhrdw/generic.h"
#include "vidhrdw/tms34061.h"
#include "vidhrdw/tlc34076.h"
#include "itech8.h"
#include <math.h>


#define FULL_LOGGING	0

#define CLOCK_8MHz		(8000000)
#define CLOCK_12MHz		(12000000)



/*************************************
 *
 *	Static data
 *
 *************************************/

static UINT8 blitter_int;
static UINT8 tms34061_int;
static UINT8 periodic_int;

static data8_t sound_data;

static data8_t pia_porta_data;
static data8_t pia_portb_data;

static data8_t *via6522;
static data16_t via6522_timer_count[2];
static void *via6522_timer[2];
static data8_t via6522_int_state;

static data8_t *main_ram;
static size_t main_ram_size;



/*************************************
 *
 *	6821 PIA interface
 *
 *************************************/

static WRITE_HANDLER( pia_porta_out );
static WRITE_HANDLER( pia_portb_out );

static struct pia6821_interface pia_interface =
{
	0, ticket_dispenser_r, 0, 0, 0, 0,			/* PIA inputs: A, B, CA1, CB1, CA2, CB2 */
	pia_porta_out, pia_portb_out, 0, 0,		/* PIA outputs: A, B, CA2, CB2 */
	0, 0									/* PIA IRQs: A, B */
};



/*************************************
 *
 *	Interrupt handling
 *
 *************************************/

void itech8_update_interrupts(int periodic, int tms34061, int blitter)
{
	/* update the states */
	if (periodic != -1) periodic_int = periodic;
	if (tms34061 != -1) tms34061_int = tms34061;
	if (blitter != -1) blitter_int = blitter;

	/* handle the 6809 case */
	if (Machine->drv->cpu[0].cpu_type == CPU_M6809)
	{
		/* just modify lines that have changed */
		if (periodic != -1) cpu_set_nmi_line(0, periodic ? ASSERT_LINE : CLEAR_LINE);
		if (tms34061 != -1) cpu_set_irq_line(0, M6809_IRQ_LINE, tms34061 ? ASSERT_LINE : CLEAR_LINE);
		if (blitter != -1) cpu_set_irq_line(0, M6809_FIRQ_LINE, blitter ? ASSERT_LINE : CLEAR_LINE);
	}

	/* handle the 68000 case */
	else
	{
		int level = 0;

		/* determine which level is active */
		if (blitter_int) level = 2;
		if (periodic_int) level = 3;

		/* update it */
		if (level)
			cpu_set_irq_line(0, level, ASSERT_LINE);
		else
			cpu_set_irq_line(0, 7, CLEAR_LINE);
	}
}



/*************************************
 *
 *	Interrupt generation
 *
 *************************************/

static INTERRUPT_GEN( generate_nmi )
{
	/* signal the NMI */
	itech8_update_interrupts(1, -1, -1);
	itech8_update_interrupts(0, -1, -1);

	if (FULL_LOGGING) log_cb(RETRO_LOG_DEBUG, LOGPRE "------------ VBLANK (%d) --------------\n", cpu_getscanline());
}


static WRITE_HANDLER( itech8_nmi_ack_w )
{
/* doesn't seem to hold for every game (e.g., hstennis) */
/*	cpu_set_nmi_line(0, CLEAR_LINE);*/
}


static void generate_sound_irq(int state)
{
	cpu_set_irq_line(1, M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
}



/*************************************
 *
 *	Machine initialization
 *
 *************************************/

static void via6522_timer_callback(int which);

static MACHINE_INIT( itech8 )
{
	/* make sure bank 0 is selected */
	if (Machine->drv->cpu[0].cpu_type == CPU_M6809)
		cpu_setbank(1, &memory_region(REGION_CPU1)[0x4000]);

	/* reset the PIA (if used) */
	pia_unconfig();
	pia_config(0, PIA_STANDARD_ORDERING, &pia_interface);
	pia_reset();

	/* reset the VIA chip (if used) */
	via6522_timer_count[0] = via6522_timer_count[1] = 0;
	via6522_timer[0] = timer_alloc(via6522_timer_callback);
	via6522_timer[1] = 0;
	via6522_int_state = 0;

	/* reset the ticket dispenser */
	ticket_dispenser_init(200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW);

	/* reset the palette chip */
	tlc34076_reset(6);
}



/*************************************
 *
 *	Bank switching
 *
 *************************************/

static WRITE_HANDLER( blitter_w )
{
	/* bit 0x20 on address 7 controls CPU banking */
	if (offset / 2 == 7)
		cpu_setbank(1, &memory_region(REGION_CPU1)[0x4000 + 0xc000 * ((data >> 5) & 1)]);

	/* the rest is handled by the video hardware */
	itech8_blitter_w(offset, data);
}


static WRITE_HANDLER( rimrockn_bank_w )
{
	/* banking is controlled here instead of by the blitter output */
	cpu_setbank(1, &memory_region(REGION_CPU1)[0x4000 + 0xc000 * (data & 3)]);
}



/*************************************
 *
 *	Input handling
 *
 *************************************/

static READ_HANDLER( special_port0_r )
{
	data8_t result = readinputport(0);
	result = (result & 0xfe) | (pia_portb_data & 0x01);
	return result;
}

/* used by Rim Rockin' Basketball */
static READ_HANDLER( special_port1_r )
{
	data8_t result = readinputport(1);
	result = (result & 0x7f) | ((pia_portb_data & 0x01) << 7);
	return result;
}

/*************************************
 *
 *	6821 PIA handling
 *
 *************************************/

static WRITE_HANDLER( pia_porta_out )
{
	log_cb(RETRO_LOG_DEBUG, LOGPRE "PIA port A write = %02x\n", data);
	pia_porta_data = data;
}


static WRITE_HANDLER( pia_portb_out )
{
	log_cb(RETRO_LOG_DEBUG, LOGPRE "PIA port B write = %02x\n", data);

	/* bit 0 provides feedback to the main CPU */
	/* bit 4 controls the ticket dispenser */
	/* bit 5 controls the coin counter */
	/* bit 6 controls the diagnostic sound LED */
	pia_portb_data = data;
	ticket_dispenser_w(0, (data & 0x10) << 3);
	coin_counter_w(0, (data & 0x20) >> 5);
}


static WRITE_HANDLER( ym2203_portb_out )
{
	log_cb(RETRO_LOG_DEBUG, LOGPRE "YM2203 port B write = %02x\n", data);

	/* bit 0 provides feedback to the main CPU */
	/* bit 5 controls the coin counter */
	/* bit 6 controls the diagnostic sound LED */
	/* bit 7 controls the ticket dispenser */
	pia_portb_data = data;
	ticket_dispenser_w(0, data & 0x80);
	coin_counter_w(0, (data & 0x20) >> 5);
}



/*************************************
 *
 *	Sound communication
 *
 *************************************/

static void delayed_sound_data_w(int data)
{
	sound_data = data;
	cpu_set_irq_line(1, M6809_IRQ_LINE, ASSERT_LINE);
}


static WRITE_HANDLER( sound_data_w )
{
	timer_set(TIME_NOW, data, delayed_sound_data_w);
}


static WRITE_HANDLER( gtg2_sound_data_w )
{
	/* on the later GTG2 board, they swizzle the data lines */
	data = ((data & 0x80) >> 7) |
	       ((data & 0x5d) << 1) |
	       ((data & 0x20) >> 3) |
	       ((data & 0x02) << 5);
	timer_set(TIME_NOW, data, delayed_sound_data_w);
}


static READ_HANDLER( sound_data_r )
{
	cpu_set_irq_line(1, M6809_IRQ_LINE, CLEAR_LINE);
	return sound_data;
}



/*************************************
 *
 *	Sound 6522 VIA handling
 *
 *************************************/

static INLINE void update_via_int(void)
{
	/* if interrupts are enabled and one is pending, set the line */
	if ((via6522[14] & 0x80) && (via6522_int_state & via6522[14]))
		cpu_set_irq_line(1, M6809_FIRQ_LINE, ASSERT_LINE);
	else
		cpu_set_irq_line(1, M6809_FIRQ_LINE, CLEAR_LINE);
}


static void via6522_timer_callback(int which)
{
	via6522_int_state |= 0x40 >> which;
	update_via_int();
}


static WRITE_HANDLER( via6522_w )
{
	double period;

	/* update the data */
	via6522[offset] = data;

	/* switch off the offset */
	switch (offset)
	{
		case 0:		/* write to port B */
			pia_portb_out(0, data);
			break;

		case 5:		/* write into high order timer 1 */
			via6522_timer_count[0] = (via6522[5] << 8) | via6522[4];
			period = TIME_IN_HZ(CLOCK_8MHz/4) * (double)via6522_timer_count[0];
			timer_adjust(via6522_timer[0], period, 0, period);

			via6522_int_state &= ~0x40;
			update_via_int();
			break;

		case 13:	/* write interrupt flag register */
			via6522_int_state &= ~data;
			update_via_int();
			break;

		default:	/* log everything else */
			if (FULL_LOGGING) log_cb(RETRO_LOG_DEBUG, LOGPRE "VIA write(%02x) = %02x\n", offset, data);
			break;
	}
}


static READ_HANDLER( via6522_r )
{
	int result = 0;

	/* switch off the offset */
	switch (offset)
	{
		case 4:		/* read low order timer 1 */
			via6522_int_state &= ~0x40;
			update_via_int();
			break;

		case 13:	/* interrupt flag register */
			result = via6522_int_state & 0x7f;
			if (via6522_int_state & via6522[14]) result |= 0x80;
			break;
	}

	if (FULL_LOGGING) log_cb(RETRO_LOG_DEBUG, LOGPRE "VIA read(%02x) = %02x\n", offset, result);
	return result;
}



/*************************************
 *
 *	16-bit memory shunts
 *
 *************************************/

static READ16_HANDLER( blitter16_r )
{
	return (itech8_blitter_r(offset * 2 + 0) << 8) + itech8_blitter_r(offset * 2 + 1);
}


static READ16_HANDLER( tms34061_16_r )
{
	/* since multiple XY accesses can move the pointer multiple times, we have to */
	/* be careful to only perform one read per access here; fortunately, the low */
	/* bit doesn't matter in XY addressing mode */
	if ((offset & 0x700) == 0x100)
	{
		int result = itech8_tms34061_r(offset * 2);
		return (result << 8) | result;
	}
	else
		return (itech8_tms34061_r(offset * 2 + 0) << 8) + itech8_tms34061_r(offset * 2 + 1);
}


static WRITE16_HANDLER( sound_data16_w )
{
	if (ACCESSING_MSB)
		sound_data_w(0, data >> 8);
}


static WRITE16_HANDLER( grom_bank16_w )
{
	if (ACCESSING_MSB)
		*itech8_grom_bank = data >> 8;
}


static WRITE16_HANDLER( display_page16_w )
{
	if (ACCESSING_MSB)
		*itech8_display_page = ~data >> 8;
}


static WRITE16_HANDLER( tms34061_latch16_w )
{
	if (ACCESSING_MSB)
		tms34061_latch_w(0, data >> 8);
}


static WRITE16_HANDLER( blitter16_w )
{
	if (ACCESSING_MSB)
		itech8_blitter_w(offset * 2 + 0, data >> 8);
	if (ACCESSING_LSB)
		itech8_blitter_w(offset * 2 + 1, data);
}


static WRITE16_HANDLER( palette16_w )
{
	if (ACCESSING_MSB)
		itech8_palette_w(offset / 8, data >> 8);
}


static WRITE16_HANDLER( tms34061_16_w )
{
	if (ACCESSING_MSB)
		itech8_tms34061_w(offset * 2 + 0, data >> 8);
	else if (ACCESSING_LSB)
		itech8_tms34061_w(offset * 2 + 1, data);
}



/*************************************
 *
 *	NVRAM read/write
 *
 *************************************/

static NVRAM_HANDLER( itech8 )
{
	int i;

	if (read_or_write)
		mame_fwrite(file, main_ram, main_ram_size);
	else if (file)
		mame_fread(file, main_ram, main_ram_size);
	else
		for (i = 0; i < main_ram_size; i++)
			main_ram[i] = rand();
}



/*************************************
 *
 *	Main CPU memory handlers
 *
 *************************************/

/*------ common layout with TMS34061 at 0000 ------*/
static MEMORY_READ_START( tmslo_readmem )
	{ 0x0000, 0x0fff, itech8_tms34061_r },
	{ 0x1140, 0x1140, special_port0_r },
	{ 0x1160, 0x1160, input_port_1_r },
	{ 0x1180, 0x1180, input_port_2_r },
	{ 0x11c0, 0x11d7, itech8_blitter_r },
	{ 0x11d8, 0x11d9, input_port_3_r },
	{ 0x11da, 0x11db, input_port_4_r },
	{ 0x11dc, 0x11dd, input_port_5_r },
	{ 0x11de, 0x11df, input_port_6_r },
	{ 0x2000, 0x3fff, MRA_RAM },
	{ 0x4000, 0xffff, MRA_BANK1 },
MEMORY_END


static MEMORY_WRITE_START( tmslo_writemem )
	{ 0x0000, 0x0fff, itech8_tms34061_w },
	{ 0x1100, 0x1100, MWA_NOP },
	{ 0x1120, 0x1120, sound_data_w },
	{ 0x1140, 0x1140, MWA_RAM, &itech8_grom_bank },
	{ 0x1160, 0x1160, MWA_RAM, &itech8_display_page },
	{ 0x1180, 0x1180, tms34061_latch_w },
	{ 0x11a0, 0x11a0, itech8_nmi_ack_w },
	{ 0x11c0, 0x11df, blitter_w },
	{ 0x11e0, 0x11ff, itech8_palette_w },
	{ 0x2000, 0x3fff, MWA_RAM, &main_ram, &main_ram_size },
	{ 0x4000, 0xffff, MWA_ROM },
MEMORY_END


/*------ common layout with TMS34061 at 1000 ------*/
static MEMORY_READ_START( tmshi_readmem )
	{ 0x1000, 0x1fff, itech8_tms34061_r },
	{ 0x0140, 0x0140, special_port0_r },
	{ 0x0160, 0x0160, input_port_1_r },
	{ 0x0180, 0x0180, input_port_2_r },
	{ 0x01c0, 0x01d7, itech8_blitter_r },
	{ 0x01d8, 0x01d9, input_port_3_r },
	{ 0x01da, 0x01db, input_port_4_r },
	{ 0x01dc, 0x01dd, input_port_5_r },
	{ 0x01de, 0x01df, input_port_6_r },
	{ 0x2000, 0x3fff, MRA_RAM },
	{ 0x4000, 0xffff, MRA_BANK1 },
MEMORY_END


static MEMORY_WRITE_START( tmshi_writemem )
	{ 0x1000, 0x1fff, itech8_tms34061_w },
	{ 0x0100, 0x0100, MWA_NOP },
	{ 0x0120, 0x0120, sound_data_w },
	{ 0x0140, 0x0140, MWA_RAM, &itech8_grom_bank },
	{ 0x0160, 0x0160, MWA_RAM, &itech8_display_page },
	{ 0x0180, 0x0180, tms34061_latch_w },
	{ 0x01a0, 0x01a0, itech8_nmi_ack_w },
	{ 0x01c0, 0x01df, blitter_w },
	{ 0x01e0, 0x01ff, itech8_palette_w },
	{ 0x2000, 0x3fff, MWA_RAM, &main_ram, &main_ram_size },
	{ 0x4000, 0xffff, MWA_ROM },
MEMORY_END


/*------ Golden Tee Golf II 1992 layout ------*/
static MEMORY_READ_START( gtg2_readmem )
	{ 0x1000, 0x1fff, itech8_tms34061_r },
	{ 0x0100, 0x0100, input_port_0_r },
	{ 0x0120, 0x0120, input_port_1_r },
	{ 0x0140, 0x0140, input_port_2_r },
	{ 0x0180, 0x0197, itech8_blitter_r },
	{ 0x0198, 0x0199, input_port_3_r },
	{ 0x019a, 0x019b, input_port_4_r },
	{ 0x019c, 0x019d, input_port_5_r },
	{ 0x019e, 0x019f, input_port_6_r },
	{ 0x2000, 0x3fff, MRA_RAM },
	{ 0x4000, 0xffff, MRA_BANK1 },
MEMORY_END


static MEMORY_WRITE_START( gtg2_writemem )
	{ 0x1000, 0x1fff, itech8_tms34061_w },
	{ 0x01c0, 0x01c0, gtg2_sound_data_w },
	{ 0x0160, 0x0160, MWA_RAM, &itech8_grom_bank },
	{ 0x0120, 0x0120, MWA_RAM, &itech8_display_page },
	{ 0x01e0, 0x01e0, tms34061_latch_w },
	{ 0x0100, 0x0100, itech8_nmi_ack_w },
	{ 0x0180, 0x019f, blitter_w },
	{ 0x0140, 0x015f, itech8_palette_w },
	{ 0x2000, 0x3fff, MWA_RAM, &main_ram, &main_ram_size },
	{ 0x4000, 0xffff, MWA_ROM },
MEMORY_END


/*------ Ninja Clowns layout ------*/
static MEMORY_READ16_START( ninclown_readmem )
	{ 0x000000, 0x003fff, MRA16_RAM },
	{ 0x004000, 0x07ffff, MRA16_ROM },
	{ 0x100100, 0x100101, input_port_0_word_r },
	{ 0x100180, 0x100181, input_port_1_word_r },
	{ 0x100280, 0x100281, input_port_2_word_r },
	{ 0x100300, 0x10031f, blitter16_r },
	{ 0x110000, 0x110fff, tms34061_16_r },
MEMORY_END


static MEMORY_WRITE16_START( ninclown_writemem )
	{ 0x000000, 0x00007f, MWA16_RAM },
	{ 0x000080, 0x003fff, MWA16_RAM, (data16_t **)&main_ram, &main_ram_size },
	{ 0x004000, 0x07ffff, MWA16_ROM },
	{ 0x100080, 0x100081, sound_data16_w },
	{ 0x100100, 0x100101, grom_bank16_w, (data16_t **)&itech8_grom_bank },
	{ 0x100180, 0x100181, display_page16_w, (data16_t **)&itech8_display_page },
	{ 0x100240, 0x100241, tms34061_latch16_w },
	{ 0x100280, 0x100281, MWA16_NOP },
	{ 0x100300, 0x10031f, blitter16_w },
	{ 0x100380, 0x1003ff, palette16_w },
	{ 0x110000, 0x110fff, tms34061_16_w },
MEMORY_END



/*************************************
 *
 *	Sound CPU memory handlers
 *
 *************************************/

/*------ YM2203-based sound board ------*/
static MEMORY_READ_START( sound2203_readmem )
	{ 0x1000, 0x1000, sound_data_r },
	{ 0x2000, 0x2000, YM2203_status_port_0_r },
	{ 0x2002, 0x2002, YM2203_status_port_0_r },
	{ 0x3000, 0x37ff, MRA_RAM },
	{ 0x4000, 0x4000, OKIM6295_status_0_r },
	{ 0x8000, 0xffff, MRA_ROM },
MEMORY_END


static MEMORY_WRITE_START( sound2203_writemem )
	{ 0x0000, 0x0000, MWA_NOP },
	{ 0x2000, 0x2000, YM2203_control_port_0_w },
	{ 0x2001, 0x2001, YM2203_write_port_0_w },
	{ 0x2002, 0x2002, YM2203_control_port_0_w },
	{ 0x2003, 0x2003, YM2203_write_port_0_w },
	{ 0x3000, 0x37ff, MWA_RAM },
	{ 0x4000, 0x4000, OKIM6295_data_0_w },
	{ 0x8000, 0xffff, MWA_ROM },
MEMORY_END


/*------ YM3812-based sound board ------*/
static MEMORY_READ_START( sound3812_readmem )
	{ 0x1000, 0x1000, sound_data_r },
	{ 0x2000, 0x2000, YM3812_status_port_0_r },
	{ 0x3000, 0x37ff, MRA_RAM },
	{ 0x4000, 0x4000, OKIM6295_status_0_r },
	{ 0x5000, 0x5003, pia_0_r },
	{ 0x8000, 0xffff, MRA_ROM },
MEMORY_END


static MEMORY_WRITE_START( sound3812_writemem )
	{ 0x0000, 0x0000, MWA_NOP },
	{ 0x2000, 0x2000, YM3812_control_port_0_w },
	{ 0x2001, 0x2001, YM3812_write_port_0_w },
	{ 0x3000, 0x37ff, MWA_RAM },
	{ 0x4000, 0x4000, OKIM6295_data_0_w },
	{ 0x5000, 0x5003, pia_0_w },
	{ 0x8000, 0xffff, MWA_ROM },
MEMORY_END



/*************************************
 *
 *	Other CPU memory handlers
 *
 *************************************/

static MEMORY_READ_START( slikz80_readmem )
	{ 0x0000, 0x7ff, MRA_ROM },
MEMORY_END


static MEMORY_WRITE_START( slikz80_writemem )
	{ 0x0000, 0x7f, MWA_ROM },
MEMORY_END


static PORT_READ_START( slikz80_readport )
	{ 0x00, 0x00, slikz80_port_r },
MEMORY_END


static PORT_WRITE_START( slikz80_writeport )
	{ 0x00, 0x00, slikz80_port_w },
MEMORY_END



/*************************************
 *
 *	Port definitions
 *
 *************************************/

#define UNUSED_ANALOG	\
	PORT_START	\
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )


INPUT_PORTS_START( stratab )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x08, DEF_STR( Upright ))
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
	PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT_NAME( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 | IPF_COCKTAIL, "P2 Right Hook" )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 | IPF_COCKTAIL, "P2 Left Hook" )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Right Hook" )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Left Hook" )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_START2 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* analog C */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER1 | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog D */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER1 | IPF_REVERSE | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog E */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER2 | IPF_COCKTAIL | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog F */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2 | IPF_COCKTAIL | IPF_REVERSE | IPF_CENTER, 25, 32, 0x80, 0x7f )
INPUT_PORTS_END


INPUT_PORTS_START( sstrike )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
	PORT_BIT     ( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT     ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1, "Left Hook" )
	PORT_BIT_NAME( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2, "Right Hook" )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )

	PORT_START	/* analog C */
    PORT_ANALOG( 0xff, 0x00, IPT_AD_STICK_X | IPF_PLAYER1, 50, 32, 0x80, 0x7f )

	PORT_START	/* analog D */
    PORT_ANALOG( 0xff, 0x00, IPT_AD_STICK_Y | IPF_PLAYER1 | IPF_REVERSE, 50, 32, 0x80, 0x7f )

	PORT_START	/* analog E */
	PORT_ANALOG( 0xff, 0x60, IPT_PADDLE | IPF_PLAYER2, 100, 1, 0x28, 0x98 )

	UNUSED_ANALOG	/* analog F */

	PORT_START	/* fake "shoot" port */
	PORT_BIT_NAME( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3, "Roll" )
INPUT_PORTS_END


INPUT_PORTS_START( wfortune )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x08, DEF_STR( Upright ))
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
	PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT     ( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3, "Blue Player" )
	PORT_BIT_NAME( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "Yellow Player" )
	PORT_BIT_NAME( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "Red Player" )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	UNUSED_ANALOG	/* analog C */

	PORT_START		/* analog D */
	PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER1, 75, 10, 0x00, 0xff )

	UNUSED_ANALOG	/* analog E */

	PORT_START		/* analog F */
	PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER2 | IPF_COCKTAIL, 75, 10, 0x00, 0xff )
INPUT_PORTS_END


INPUT_PORTS_START( gtg )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x08, DEF_STR( Upright ))
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
	PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	/* it is still unknown how the second player inputs are muxed in */
	/* currently we map both sets of controls to the same inputs */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_COCKTAIL )
	PORT_BIT     ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
	PORT_BIT     ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_COCKTAIL )
	PORT_BIT     ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
	PORT_BIT     ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_COCKTAIL )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_COCKTAIL )
	PORT_BIT_NAME( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P2 Swing" )
	PORT_BIT_NAME( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 | IPF_COCKTAIL, "P2 Swing" )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	UNUSED_ANALOG	/* analog C */
	UNUSED_ANALOG	/* analog D */
	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END


INPUT_PORTS_START( gtg2 )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x40, DEF_STR( Upright ))
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* 60 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Face Right" )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Face Left" )
	PORT_BIT     ( 0x78, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_START1 )

	PORT_START	/* 80 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 | IPF_COCKTAIL, "P2 Face Right" )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 | IPF_COCKTAIL, "P2 Face Left" )
	PORT_BIT     ( 0x78, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_START2 )

	PORT_START	/* analog C */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER1 | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog D */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER1 | IPF_REVERSE | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog E */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2 | IPF_COCKTAIL | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog F */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER2 | IPF_COCKTAIL | IPF_REVERSE | IPF_CENTER, 25, 32, 0x80, 0x7f )
INPUT_PORTS_END


INPUT_PORTS_START( gtg2t )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x08, DEF_STR( Upright ))
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
	PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT_NAME( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 | IPF_COCKTAIL, "P2 Face Right" )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 | IPF_COCKTAIL, "P2 Face Left" )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Face Right" )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Face Left" )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_START2 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* analog C */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER1 | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog D */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER1 | IPF_REVERSE | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog E */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2 | IPF_COCKTAIL | IPF_CENTER, 25, 32, 0x80, 0x7f )

	PORT_START	/* analog F */
    PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER2 | IPF_COCKTAIL | IPF_REVERSE | IPF_CENTER, 25, 32, 0x80, 0x7f )
INPUT_PORTS_END

INPUT_PORTS_START( gpgolf )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x40, DEF_STR( Upright ))
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* 60 */

	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT     ( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Swing" )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_START1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	UNUSED_ANALOG	/* analog C */
	UNUSED_ANALOG	/* analog D */
	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END


INPUT_PORTS_START( slikshot )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
	PORT_BIT     ( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT     ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2, "Yellow" )
	PORT_BIT_NAME( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3, "Red" )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT_NAME( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1, "Green" )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )

	PORT_START	/* analog C */
    PORT_ANALOG( 0xff, 0x00, IPT_AD_STICK_X | IPF_PLAYER1, 50, 32, 0x80, 0x7f )

	PORT_START	/* analog D */
    PORT_ANALOG( 0xff, 0x00, IPT_AD_STICK_Y | IPF_PLAYER1 | IPF_REVERSE, 50, 32, 0x80, 0x7f )

	PORT_START	/* analog E */
	PORT_ANALOG( 0xff, 0x60, IPT_PADDLE | IPF_PLAYER2, 100, 1, 0x28, 0x98 )

	UNUSED_ANALOG	/* analog F */

	PORT_START	/* fake "shoot" port */
	PORT_BIT_NAME( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4, "Shoot" )
INPUT_PORTS_END


INPUT_PORTS_START( dynobop )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* ball gate */
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* ball detect */
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 )
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )

	PORT_START	/* analog C */
    PORT_ANALOG( 0xff, 0x00, IPT_AD_STICK_X | IPF_PLAYER1, 50, 32, 0x80, 0x7f )

	PORT_START	/* analog D */
    PORT_ANALOG( 0xff, 0x00, IPT_AD_STICK_Y | IPF_PLAYER1 | IPF_REVERSE, 50, 32, 0x80, 0x7f )

	PORT_START	/* analog E */
	PORT_ANALOG( 0xff, 0x60, IPT_PADDLE | IPF_PLAYER2, 100, 1, 0x28, 0x98 )

	UNUSED_ANALOG	/* analog F */

	PORT_START	/* fake "shoot" port */
/*	PORT_BIT_NAME( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4, "Shoot" )*/
INPUT_PORTS_END


INPUT_PORTS_START( arlingtn )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ))	/* see code at e23c */
	PORT_DIPSETTING(    0x00, DEF_STR( Off ))
	PORT_DIPSETTING(    0x08, DEF_STR( On ))
	PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT     ( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2, "Place" )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1, "Win" )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
	PORT_BIT     ( 0x06, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3, "Show" )
	PORT_BIT_NAME( 0x10, IP_ACTIVE_LOW, IPT_START1, "Start Race" )
	PORT_BIT_NAME( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4, "Collect" )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )

	UNUSED_ANALOG	/* analog C */
	UNUSED_ANALOG	/* analog D */
	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END


INPUT_PORTS_START( neckneck )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ))	/* see code at e23c */
	PORT_DIPSETTING(    0x00, DEF_STR( Off ))
	PORT_DIPSETTING(    0x08, DEF_STR( On ))
	PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT     ( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3, "Horse 3" )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2, "Horse 2" )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT_NAME( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1, "Horse 1" )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
	PORT_BIT     ( 0x06, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT_NAME( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4, "Horse 4" )
	PORT_BIT_NAME( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6, "Horse 6" )
	PORT_BIT_NAME( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5, "Horse 5" )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )

	UNUSED_ANALOG	/* analog C */
	UNUSED_ANALOG	/* analog D */
	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END


INPUT_PORTS_START( peggle )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
	PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	UNUSED_ANALOG	/* analog C */
	UNUSED_ANALOG	/* analog D */
	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END


INPUT_PORTS_START( pegglet )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	UNUSED_ANALOG	/* analog C */

	PORT_START		/* analog D */
	PORT_ANALOG( 0xff, 0x00, IPT_DIAL | IPF_PLAYER1 | IPF_CENTER, 50, 10, 0x80, 0x7f )

	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END


INPUT_PORTS_START( hstennis )
	PORT_START	/* 40 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */
	PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x08, DEF_STR( Upright ))
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ))	/* see code at fbb5 */
	PORT_DIPSETTING(    0x00, DEF_STR( Off ))
	PORT_DIPSETTING(    0x10, DEF_STR( On ))
	PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )

	PORT_START	/* 60 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER1, "P2 Soft" )
	PORT_BIT     ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
	PORT_BIT_NAME( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER1, "P1 Hard" )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

	PORT_START	/* 80 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER2, "P2 Soft" )
	PORT_BIT     ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 )
	PORT_BIT_NAME( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER2, "P2 Hard" )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )

	UNUSED_ANALOG	/* analog C */
	UNUSED_ANALOG	/* analog D */
	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END


INPUT_PORTS_START( rimrockn )
	PORT_START	/* 40 */
    PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )

	PORT_START	/* 60 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
	PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN4 )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* input from sound board */

	PORT_START	/* 80 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )

	PORT_START	/* special 161 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER1, "P1 Pass" )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER1, "P1 Shoot" )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_START1 )

	PORT_START	/* special 162 */
	PORT_BIT     ( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER2, "P2 Pass" )
	PORT_BIT_NAME( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER2, "P2 Shoot" )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_START2 )

	PORT_START	/* special 163 */
	PORT_BIT_NAME( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER3, "P3 Shoot" )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER3, "P3 Pass" )
	PORT_BIT     ( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER3 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER3 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER3 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_START3 )

	PORT_START	/* special 164 */
	PORT_BIT_NAME( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER4, "P4 Shoot" )
	PORT_BIT_NAME( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER4, "P4 Pass" )
	PORT_BIT     ( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT     ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER4 )
	PORT_BIT     ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER4 )
	PORT_BIT     ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER4 )
	PORT_BIT     ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER4 )
	PORT_BIT     ( 0x80, IP_ACTIVE_LOW, IPT_START4 )

	PORT_START	/* special 165 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE3 )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE4 )
	PORT_DIPNAME( 0x18, 0x00, DEF_STR( Cabinet ))
	PORT_DIPSETTING(    0x18, "1 player" )
	PORT_DIPSETTING(    0x10, "2 players" )
	PORT_DIPSETTING(    0x08, "3 players" )
	PORT_DIPSETTING(    0x00, "4 players" )
	PORT_DIPNAME( 0x20, 0x00, "Coin Slots" )
	PORT_DIPSETTING(    0x04, "Common" )
	PORT_DIPSETTING(    0x00, "Individual" )
	PORT_DIPNAME( 0x40, 0x00, "Video Sync" )
	PORT_DIPSETTING(    0x02, "Positive" )
	PORT_DIPSETTING(    0x00, "Negative" )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END


INPUT_PORTS_START( ninclown )
	PORT_START	/* 40 */
	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_SERVICE1 )
	PORT_SERVICE_NO_TOGGLE( 0x0200, IP_ACTIVE_LOW )
	PORT_BIT( 0x0c00, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN1 )
	PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNKNOWN )

	PORT_START	/* 60 */
	PORT_BIT_NAME( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER1, "P1 Throw" )
	PORT_BIT     ( 0x0200, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT     ( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
	PORT_BIT     ( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
	PORT_BIT     ( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
	PORT_BIT     ( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
	PORT_BIT_NAME( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER1, "P1 Kick" )
	PORT_BIT_NAME( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER1, "P1 Punch" )

	PORT_START	/* 80 */
	PORT_BIT_NAME( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER2, "P2 Throw" )
	PORT_BIT     ( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
	PORT_BIT     ( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 )
	PORT_BIT     ( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 )
	PORT_BIT     ( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 )
	PORT_BIT     ( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
	PORT_BIT_NAME( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER2, "P2 Kick" )
	PORT_BIT_NAME( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER2, "P2 Punch" )

	UNUSED_ANALOG	/* analog C */
	UNUSED_ANALOG	/* analog D */
	UNUSED_ANALOG	/* analog E */
	UNUSED_ANALOG	/* analog F */
INPUT_PORTS_END



/*************************************
 *
 *	Sound definitions
 *
 *************************************/

static struct YM2203interface ym2203_interface =
{
	1,
	CLOCK_8MHz/2,
	{ YM2203_VOL(75,7) },
	{ 0 },
	{ 0 },
	{ 0 },
	{ ym2203_portb_out },
	{ generate_sound_irq }
};


static struct YM3812interface ym3812_interface =
{
	1,
	CLOCK_8MHz/2,
	{ 75 },
	{ generate_sound_irq }
};


static struct OKIM6295interface oki6295_interface_low =
{
	1,
	{ CLOCK_8MHz/8/165 },
	{ REGION_SOUND1 },
	{ 75 }
};


static struct OKIM6295interface oki6295_interface_high =
{
	1,
	{ CLOCK_8MHz/8/128 },
	{ REGION_SOUND1 },
	{ 75 }
};



/*************************************
 *
 *	Machine driver
 *
 *************************************/

/************* core pieces ******************/

static MACHINE_DRIVER_START( itech8_core_lo )

	/* basic machine hardware */
	MDRV_CPU_ADD_TAG("main", M6809, CLOCK_8MHz/4)
	MDRV_CPU_MEMORY(tmslo_readmem,tmslo_writemem)
	MDRV_CPU_VBLANK_INT(generate_nmi,1)

	MDRV_FRAMES_PER_SECOND(60)
	MDRV_VBLANK_DURATION((int)(((263. - 240.) / 263.) * 1000000. / 60.))

	MDRV_MACHINE_INIT(itech8)
	MDRV_NVRAM_HANDLER(itech8)

	/* video hardware */
	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_BEFORE_VBLANK)
	MDRV_SCREEN_SIZE(512, 263)
	MDRV_VISIBLE_AREA(0, 255, 0, 239)
	MDRV_PALETTE_LENGTH(256)

	MDRV_VIDEO_START(itech8)
	MDRV_VIDEO_UPDATE(itech8)

	/* sound hardware */
	MDRV_SOUND_ADD_TAG("oki", OKIM6295, oki6295_interface_high)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( itech8_core_hi )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_lo)
	MDRV_CPU_MODIFY("main")
	MDRV_CPU_MEMORY(tmshi_readmem,tmshi_writemem)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( itech8_sound_ym2203 )

	/* basic machine hardware */
	MDRV_CPU_ADD_TAG("sound", M6809, CLOCK_8MHz/4)
	MDRV_CPU_MEMORY(sound2203_readmem,sound2203_writemem)

	/* sound hardware */
	MDRV_SOUND_ADD_TAG("ym", YM2203, ym2203_interface)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( itech8_sound_ym3812 )

	/* basic machine hardware */
	MDRV_CPU_ADD_TAG("sound", M6809, CLOCK_8MHz/4)
	MDRV_CPU_MEMORY(sound3812_readmem,sound3812_writemem)

	/* sound hardware */
	MDRV_SOUND_ADD_TAG("ym", YM3812, ym3812_interface)
MACHINE_DRIVER_END


/************* full drivers ******************/

static MACHINE_DRIVER_START( tmslo2203 )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_lo)
	MDRV_IMPORT_FROM(itech8_sound_ym2203)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( tmshi2203 )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_hi)
	MDRV_IMPORT_FROM(itech8_sound_ym2203)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( gtg2 )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_lo)
	MDRV_IMPORT_FROM(itech8_sound_ym3812)

	MDRV_CPU_MODIFY("main")
	MDRV_CPU_MEMORY(gtg2_readmem,gtg2_writemem)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( peggle )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_lo)
	MDRV_IMPORT_FROM(itech8_sound_ym3812)

	/* video hardware */
	MDRV_VISIBLE_AREA(18, 367, 0, 239)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( arlingtn )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_hi)
	MDRV_IMPORT_FROM(itech8_sound_ym3812)

	/* video hardware */
	MDRV_VISIBLE_AREA(16, 389, 0, 239)

	/* sound hardware */
	MDRV_SOUND_REPLACE("oki", OKIM6295, oki6295_interface_low)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( neckneck )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_lo)
	MDRV_IMPORT_FROM(itech8_sound_ym3812)

	/* video hardware */
	MDRV_VISIBLE_AREA(8, 375, 0, 239)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( hstennis )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_hi)
	MDRV_IMPORT_FROM(itech8_sound_ym3812)

	/* video hardware */
	MDRV_VISIBLE_AREA(0, 375, 0, 239)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( rimrockn )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_hi)
	MDRV_IMPORT_FROM(itech8_sound_ym3812)

	MDRV_CPU_REPLACE("main", M6809, CLOCK_12MHz/4)

	/* video hardware */
	MDRV_VISIBLE_AREA(24, 375, 0, 239)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( ninclown )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_hi)
	MDRV_IMPORT_FROM(itech8_sound_ym3812)

	MDRV_CPU_REPLACE("main", M68000, CLOCK_12MHz)
	MDRV_CPU_MEMORY(ninclown_readmem,ninclown_writemem)

	/* video hardware */
	MDRV_VISIBLE_AREA(64, 423, 0, 239)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( slikshot )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_hi)
	MDRV_IMPORT_FROM(itech8_sound_ym2203)

	MDRV_CPU_ADD(Z80, CLOCK_8MHz/2)
	MDRV_CPU_MEMORY(slikz80_readmem,slikz80_writemem)
	MDRV_CPU_PORTS(slikz80_readport,slikz80_writeport)

	/* video hardware */
	MDRV_VISIBLE_AREA(0, 255, 0, 239)
	MDRV_PALETTE_LENGTH(256+1)

	MDRV_VIDEO_START(slikshot)
MACHINE_DRIVER_END


static MACHINE_DRIVER_START( sstrike )

	/* basic machine hardware */
	MDRV_IMPORT_FROM(itech8_core_lo)
	MDRV_IMPORT_FROM(itech8_sound_ym2203)

	MDRV_CPU_ADD(Z80, CLOCK_8MHz/2)
	MDRV_CPU_MEMORY(slikz80_readmem,slikz80_writemem)
	MDRV_CPU_PORTS(slikz80_readport,slikz80_writeport)

	/* video hardware */
	MDRV_VISIBLE_AREA(0, 255, 0, 239)
	MDRV_PALETTE_LENGTH(256+1)

	MDRV_VIDEO_START(slikshot)
MACHINE_DRIVER_END



/*************************************
 *
 *	ROM definitions
 *
 *************************************/

ROM_START( stratab )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "sbprogv3.bin", 0x08000, 0x8000, CRC(a5ae728f) SHA1(85098eef1614d5148e8082df4c936883662292ee) )
	ROM_COPY( REGION_CPU1,    0x8000, 0x14000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "sbsnds.bin", 0x08000, 0x8000, CRC(b36c8f0a) SHA1(c4c3edf3352d95561f76705087338c1946137447) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a915b0bd) SHA1(0955c7ebb48e97ccffc18c5deec6eccce1d68de8) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(340c661f) SHA1(150f9158fa6d956d08051c67c17723b1d8c66867) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(5df9f1cf) SHA1(cad87f63ac0e902dffeeaa42538fc73f792d87d9) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x20000, CRC(6ff390b9) SHA1(f31dae9e31f3fc83b9253e49fd4204820db3587e) )
ROM_END


ROM_START( stratab1 )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "sbprgv1.bin",  0x08000, 0x8000, CRC(46d51604) SHA1(de7b6306fdcee4907b07667baf874bd195822e6a) )
	ROM_COPY( REGION_CPU1,    0x8000, 0x14000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "sbsnds.bin", 0x08000, 0x8000, CRC(b36c8f0a) SHA1(c4c3edf3352d95561f76705087338c1946137447) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a915b0bd) SHA1(0955c7ebb48e97ccffc18c5deec6eccce1d68de8) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(340c661f) SHA1(150f9158fa6d956d08051c67c17723b1d8c66867) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(5df9f1cf) SHA1(cad87f63ac0e902dffeeaa42538fc73f792d87d9) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x20000, CRC(6ff390b9) SHA1(f31dae9e31f3fc83b9253e49fd4204820db3587e) )
ROM_END


ROM_START( wfortune )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "wofpgm", 0x04000, 0x4000, CRC(bd984654) SHA1(8e16d2feb26e9a6f86c4a36bf0f03db80ded03f6) )
	ROM_CONTINUE(       0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "wofsnd", 0x08000, 0x8000, CRC(0a6aa5dc) SHA1(42eef40a4300d6d16d9e2af678432a02be05f104) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "wofgrom0", 0x00000, 0x10000, CRC(9a157b2c) SHA1(c349b41ba00cf6e2fec32872627c8cfdd8b5c1b9) )
	ROM_LOAD( "wofgrom1", 0x10000, 0x10000, CRC(5064739b) SHA1(424e3f94333f8ca21ac39b64b684cf6b487164d3) )
	ROM_LOAD( "wofgrom2", 0x20000, 0x10000, CRC(3d393b2b) SHA1(2c94d2dab7369c099c470cf96391b033f39add78) )
	ROM_LOAD( "wofgrom3", 0x30000, 0x10000, CRC(117a2ce9) SHA1(8d601c1cf9f783a42617f13c6862a5835553ac4f) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "wofsbom0", 0x00000, 0x20000, CRC(5c28c3fe) SHA1(eba64ede749fb26f9926f644d66860b54b4c76e7) )
ROM_END


ROM_START( wfortuna )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "wofpgmr1.bin", 0x04000, 0x4000, CRC(c3d3eb21) SHA1(21137663afd19fba875e188640f0347fc8c5dcf0) )
	ROM_CONTINUE(             0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "wofsnd", 0x08000, 0x8000, CRC(0a6aa5dc) SHA1(42eef40a4300d6d16d9e2af678432a02be05f104) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "wofgrom0", 0x00000, 0x10000, CRC(9a157b2c) SHA1(c349b41ba00cf6e2fec32872627c8cfdd8b5c1b9) )
	ROM_LOAD( "wofgrom1", 0x10000, 0x10000, CRC(5064739b) SHA1(424e3f94333f8ca21ac39b64b684cf6b487164d3) )
	ROM_LOAD( "wofgrom2", 0x20000, 0x10000, CRC(3d393b2b) SHA1(2c94d2dab7369c099c470cf96391b033f39add78) )
	ROM_LOAD( "wofgrom3", 0x30000, 0x10000, CRC(117a2ce9) SHA1(8d601c1cf9f783a42617f13c6862a5835553ac4f) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "wofsbom0", 0x00000, 0x20000, CRC(5c28c3fe) SHA1(eba64ede749fb26f9926f644d66860b54b4c76e7) )
ROM_END


ROM_START( gtg )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "u5.bin", 0x04000, 0x4000, CRC(61984272) SHA1(be735f8576fb2cccc0e9e6ea6f2fd54b6c0b3bb3) )
	ROM_CONTINUE(       0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(358d2440) SHA1(7b09350c89f9d2c86dc187d8812bbf26b576a38f) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(b52a23f6) SHA1(092961acf47875179b44342e2dd8955670e67ea2) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(9b8e3a61) SHA1(1b5682b1328d6c97b604fb71512e8f72322a688f) )
	ROM_LOAD( "grom3.bin", 0x60000, 0x20000, CRC(b6e9fb15) SHA1(c1b28ea911696cb4ed56bfba212848693530b59f) )
	ROM_LOAD( "grom4.bin", 0x80000, 0x20000, CRC(faa16729) SHA1(5d46cddda66b6d23c9ebdf2fb4cebce15586b4ad) )
	ROM_LOAD( "grom5.bin", 0xa0000, 0x20000, CRC(5b393314) SHA1(9e314a75ea52373369904915ec786f09eee725a9) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x20000, CRC(1cccbfdf) SHA1(546059fea2e7cd5627a666d80b1fc3ed8fcc0762) )
ROM_END


ROM_START( slikshot )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "pgm20.u5",  0x04000, 0x4000, CRC(370a00eb) SHA1(b2878f161f4931d9fc3979a84b29660941e2608f) )
	ROM_CONTINUE(          0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(a96ce0f7) SHA1(c1fec3aeef97c846fd1a20b91af54f6bf9723a71) )

	ROM_REGION( 0x10000, REGION_CPU3, 0 )
	ROM_LOAD( "u53.bin", 0x00000, 0x0800, CRC(04b85918) SHA1(409aef2e71937c7654334999df9313909d757966) )
	ROM_CONTINUE(        0x00000, 0x0800 )
	ROM_CONTINUE(        0x00000, 0x0800 )
	ROM_CONTINUE(        0x00000, 0x0800 )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(e60c2804) SHA1(e62d11b6c4439a70a2f32df72c8c64e2f110351e) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(d764d542) SHA1(43fc0c9b627484a670d87da91e212741b137e995) )

	ROM_REGION( 0x10000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x10000, CRC(4b075f5e) SHA1(d1ac2c06352a5b96486a7e8cf8baae0c0e5b1883) )
ROM_END


ROM_START( sliksh17 )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "u5.bin", 0x04000, 0x4000, CRC(09d70554) SHA1(a009cd3b22261c60f1028694baef51f61713154f) )
	ROM_CONTINUE(       0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(a96ce0f7) SHA1(c1fec3aeef97c846fd1a20b91af54f6bf9723a71) )

	ROM_REGION( 0x10000, REGION_CPU3, 0 )
	ROM_LOAD( "u53.bin", 0x00000, 0x0800, CRC(04b85918) SHA1(409aef2e71937c7654334999df9313909d757966) )
	ROM_CONTINUE(        0x00000, 0x0800 )
	ROM_CONTINUE(        0x00000, 0x0800 )
	ROM_CONTINUE(        0x00000, 0x0800 )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(e60c2804) SHA1(e62d11b6c4439a70a2f32df72c8c64e2f110351e) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(d764d542) SHA1(43fc0c9b627484a670d87da91e212741b137e995) )

	ROM_REGION( 0x10000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x10000, CRC(4b075f5e) SHA1(d1ac2c06352a5b96486a7e8cf8baae0c0e5b1883) )
ROM_END


ROM_START( dynobop )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "dynobop.u5", 0x04000, 0x4000, CRC(98452c40) SHA1(9b9316fc258792e0d825f16e0fadf8e0c35a864e) )
	ROM_CONTINUE(           0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1,  0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "dynobop.u27", 0x08000, 0x8000, CRC(a37d862b) SHA1(922eeae184df2c5c28040da27699dd55744f8dca) )

	ROM_REGION( 0x10000, REGION_CPU3, 0 )
	ROM_LOAD( "dynobop.u53", 0x00000, 0x0800, CRC(04b85918) SHA1(409aef2e71937c7654334999df9313909d757966) )
	ROM_CONTINUE(            0x00000, 0x0800 )
	ROM_CONTINUE(            0x00000, 0x0800 )
	ROM_CONTINUE(            0x00000, 0x0800 )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "dynobop.gr0", 0x00000, 0x20000, CRC(3525a7a3) SHA1(fe0b08203c135d55507506936dc34e1503e4906b) )
	ROM_LOAD( "dynobop.gr1", 0x20000, 0x20000, CRC(1544a232) SHA1(60bba76537c82887db8e38c6a87c528afdd385d0) )

	ROM_REGION( 0x10000, REGION_SOUND1, 0 )
	ROM_LOAD( "dynobop.sr0", 0x00000, 0x10000, CRC(b355bf1d) SHA1(c9745638feb33ec181b8d9a894421f9854286cd9) )
ROM_END


ROM_START( sstrike )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "sstrku5.bin", 0x08000, 0x8000, CRC(af00cddf) SHA1(b866e8dfce1449f7462a79efa385ea6b55cdc6e7) )
	ROM_COPY( REGION_CPU1,    0x8000, 0x14000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "sstrku27.bin", 0x08000, 0x8000, CRC(efab7252) SHA1(eb3b2002531e551e3d67958ea3cc56a69fa660e2) )

	ROM_REGION( 0x10000, REGION_CPU3, 0 )
	ROM_LOAD( "spstku53.bin", 0x00000, 0x0800, CRC(04b85918) SHA1(409aef2e71937c7654334999df9313909d757966) )
	ROM_CONTINUE(        0x00000, 0x0800 )
	ROM_CONTINUE(        0x00000, 0x0800 )
	ROM_CONTINUE(        0x00000, 0x0800 )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "sstgrom0.bin", 0x00000, 0x20000, CRC(9cfb9849) SHA1(5aa860c0c6e3916ebdb8898ee44f633bf3347ca8) )
	ROM_LOAD( "sstgrom1.bin", 0x20000, 0x20000, CRC(d9ea14e1) SHA1(4cddf3237c203b0a3f7ae770f85f1be35e9e1b78) )
	ROM_LOAD( "sstgrom2.bin", 0x40000, 0x20000, CRC(dcd97bf7) SHA1(95361222ac58bf74539f2a7e80574bcd848c615e) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "sstsrom0.bin", 0x00000, 0x20000, CRC(6ff390b9) SHA1(f31dae9e31f3fc83b9253e49fd4204820db3587e) )
ROM_END

ROM_START( gpgolf )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "gpgjv1_1.bin",   0x04000, 0x4000, CRC(631e77e0) SHA1(847ba1e00d31441620a2a1f45a9aa58df84bde8b) )
	ROM_CONTINUE(       0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "sndv1.u27", 0x08000, 0x8000, CRC(55734876) SHA1(eb5ef816acbc6e35642749e38a2908b7ba359b9d) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom00.bin", 0x00000, 0x40000, CRC(c3a7b54b) SHA1(414d693bc5337d578d2630817dd647cf7e5cbcf7) )
	ROM_LOAD( "grom01.bin", 0x40000, 0x40000, BAD_DUMP CRC(2c834cf9) SHA1(49eb070ca4439d4fcd2d8a2db62d3c99b824bf99) ) /* Self test checksum reports BAD */
	ROM_LOAD( "grom02.bin", 0x80000, 0x40000, CRC(aebe6c45) SHA1(15e64fcb36cb1064988ee5cd45699d501a6e7f01) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom00.bin", 0x00000, 0x20000, CRC(4dd4db42) SHA1(0dffb51e8de36d8747f443fd65fe9927815eaff0) )
ROM_END


ROM_START( gtg2 )
	/* banks are loaded in the opposite order from the others, */
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "u5.2",   0x10000, 0x4000, CRC(4a61580f) SHA1(7c64648d47418fbcc0f9b5bd91f88856209bc0f5) )
	ROM_CONTINUE(       0x04000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x8000, 0x14000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27.2", 0x08000, 0x8000, CRC(55734876) SHA1(eb5ef816acbc6e35642749e38a2908b7ba359b9d) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(a4182776) SHA1(9f4704d1a61a4fffce454c82cb3eb4629d9a2006) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(0580bb99) SHA1(012d473bc63632a5ed1a250daa54a00a4e30e8b2) )
	ROM_LOAD( "grom3.bin", 0x60000, 0x20000, CRC(89edb624) SHA1(e77d5ecd04f44f184e76eb2506660a04b6bc7fe8) )
	ROM_LOAD( "grom4.bin", 0x80000, 0x20000, CRC(f6557950) SHA1(fd2bbd6b852a9f2775a23d9fdaa20d31d6766d7f) )
	ROM_LOAD( "grom5.bin", 0xa0000, 0x20000, CRC(a680ce6a) SHA1(fe51546933c093cea81858b213afb0e926e9eb4e) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "vr-srom0", 0x00000, 0x20000, CRC(4dd4db42) SHA1(0dffb51e8de36d8747f443fd65fe9927815eaff0) )
ROM_END


ROM_START( gtg2t )
	/* banks are loaded in the opposite order from the others, */
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "u5",     0x10000, 0x4000, CRC(c7b3a9f3) SHA1(5edaca6fd6ee58bd1676dc9b2c86da4dd2f51687) )
	ROM_CONTINUE(       0x04000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x8000, 0x14000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(dd2a5905) SHA1(dc93f13de3953852a6757361eb9683a57d3ed326) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(a4182776) SHA1(9f4704d1a61a4fffce454c82cb3eb4629d9a2006) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(0580bb99) SHA1(012d473bc63632a5ed1a250daa54a00a4e30e8b2) )
	ROM_LOAD( "grom3.bin", 0x60000, 0x20000, CRC(89edb624) SHA1(e77d5ecd04f44f184e76eb2506660a04b6bc7fe8) )
	ROM_LOAD( "grom4.bin", 0x80000, 0x20000, CRC(f6557950) SHA1(fd2bbd6b852a9f2775a23d9fdaa20d31d6766d7f) )
	ROM_LOAD( "grom5.bin", 0xa0000, 0x20000, CRC(a680ce6a) SHA1(fe51546933c093cea81858b213afb0e926e9eb4e) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "vr-srom0", 0x00000, 0x20000, CRC(4dd4db42) SHA1(0dffb51e8de36d8747f443fd65fe9927815eaff0) )
ROM_END


ROM_START( gtg2j )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "u5.bin", 0x04000, 0x4000, CRC(9c95ceaa) SHA1(d9fd2b2419c026822a07d2ba51d6ab40b7cd0d49) )
	ROM_CONTINUE(       0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(dd2a5905) SHA1(dc93f13de3953852a6757361eb9683a57d3ed326) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(a4182776) SHA1(9f4704d1a61a4fffce454c82cb3eb4629d9a2006) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(0580bb99) SHA1(012d473bc63632a5ed1a250daa54a00a4e30e8b2) )
	ROM_LOAD( "grom3.bin", 0x60000, 0x20000, CRC(89edb624) SHA1(e77d5ecd04f44f184e76eb2506660a04b6bc7fe8) )
	ROM_LOAD( "grom4.bin", 0x80000, 0x20000, CRC(f6557950) SHA1(fd2bbd6b852a9f2775a23d9fdaa20d31d6766d7f) )
	ROM_LOAD( "grom5.bin", 0xa0000, 0x20000, CRC(a680ce6a) SHA1(fe51546933c093cea81858b213afb0e926e9eb4e) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x20000, CRC(1cccbfdf) SHA1(546059fea2e7cd5627a666d80b1fc3ed8fcc0762) )
ROM_END


ROM_START( arlingtn )
	/* banks are loaded in the opposite order from the others, */
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "ahrd121.bin", 0x10000, 0x4000, CRC(00aae02e) SHA1(3bcfbd256c34ae222dde24ba9544f19da70b698e) )
	ROM_CONTINUE(            0x04000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x8000, 0x14000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "ahrsnd11.bin", 0x08000, 0x8000, CRC(dec57dca) SHA1(21a8ead10b0434629f41f6b067c49b6622569a6c) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(5ef57fe5) SHA1(e877979e034a61968b432037501e25a302a17a9a) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(6aca95c0) SHA1(da7a899bf0812a7af178e48b5a626ce56a836579) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x10000, CRC(6d6fde1b) SHA1(aaabc45d4b566be42e8d28d767e4771a96d9caae) )

	ROM_REGION( 0x40000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x40000, CRC(56087f81) SHA1(1d4a1f396ee9d8ed51d0417ea94b0b379312d72f) )
ROM_END


ROM_START( neckneck )
	/* banks are loaded in the opposite order from the others, */
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "nn_prg12.u5", 0x04000, 0x4000, CRC(8e51734a) SHA1(c184af73670235a9245bfdeec2b58acfe93170e3) )
	ROM_CONTINUE(            0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "nn_snd10.u27", 0x08000, 0x8000, CRC(74771b2f) SHA1(0a963d2962699bb1b4d08bd486979151d0a228da) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "nn_grom0.bin", 0x00000, 0x20000, CRC(064d1464) SHA1(4ce5bcadad93586c9af2b0c499d7a7140b080cdb) )
	ROM_LOAD( "nn_grom1.bin", 0x20000, 0x20000, CRC(622d9a0b) SHA1(f084dcf194cfc658f97f36972f2b2ff30e834fc5) )
	ROM_LOAD( "nn_grom2.bin", 0x40000, 0x20000, CRC(e7eb4020) SHA1(29ceb535d1dfddf8c12cf78919ea10f6b956b8b3) )
	ROM_LOAD( "nn_grom3.bin", 0x60000, 0x20000, CRC(765c8593) SHA1(a39d757a01d61b637b264bdb4449e090a1e90219) )

	ROM_REGION( 0x40000, REGION_SOUND1, 0 )
	ROM_LOAD( "nn_srom0.bin", 0x00000, 0x40000, CRC(33687201) SHA1(7c84d453fb7e59b0a27cd68a049d019ff65f6f19) )
ROM_END


ROM_START( peggle )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "j-stick.u5", 0x04000, 0x4000, CRC(140d5a9c) SHA1(841e5f45c6f306d9bd286e7d3e3c75b169c932e1) )
	ROM_CONTINUE(           0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "sound.u27", 0x08000, 0x8000, CRC(b99beb70) SHA1(8d82c3b081a1afb236afa658abb3aa605c6c2264) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(5c02348d) SHA1(c85352728d94b3a5ca78c2493e98bdb4b3206bed) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(85a7a3a2) SHA1(7fb7be67c75867fcccf4272f1ce42f2af94c16e6) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(bfe11f18) SHA1(5e8d36c6a86a8eb883f50620fbfcea3d8398faeb) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0", 0x00000, 0x20000, CRC(001846ea) SHA1(6a6b77f6d51c4a68105c935804b896aad9981719) )
ROM_END


ROM_START( pegglet )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "trakball.u5", 0x04000, 0x4000, CRC(d2694868) SHA1(9945a308550c9d89a647d80257e3ab14f793ac6f) )
	ROM_CONTINUE(            0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "sound.u27", 0x08000, 0x8000, CRC(b99beb70) SHA1(8d82c3b081a1afb236afa658abb3aa605c6c2264) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(5c02348d) SHA1(c85352728d94b3a5ca78c2493e98bdb4b3206bed) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(85a7a3a2) SHA1(7fb7be67c75867fcccf4272f1ce42f2af94c16e6) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(bfe11f18) SHA1(5e8d36c6a86a8eb883f50620fbfcea3d8398faeb) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0", 0x00000, 0x20000, CRC(001846ea) SHA1(6a6b77f6d51c4a68105c935804b896aad9981719) )
ROM_END


ROM_START( hstennis )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "tenbim.v11", 0x04000, 0x4000, CRC(faffab5c) SHA1(4de525f6adb16205c47788b78aecdebd57008295) )
	ROM_CONTINUE(           0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1,  0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "tensnd.v1", 0x08000, 0x8000, CRC(f034a694) SHA1(3540e2edff2ce47504260ec856bab9b638d9260d) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(1e69ebae) SHA1(a32e2c2f4e4a527ae6b57adeccd2c4d2045ab5fe) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(4e6a22d5) SHA1(3c2d51dd874f61c0a557ea2c1968afa02d9bfc42) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(c0b643a9) SHA1(d240f703a55c39ce4a969612fbb9cd76e4b849ac) )
	ROM_LOAD( "grom3.bin", 0x60000, 0x20000, CRC(54afb456) SHA1(0a7f10b1a490825a85489ac3f678eb1e11a0ac65) )
	ROM_LOAD( "grom4.bin", 0x80000, 0x20000, CRC(ee09d645) SHA1(8233cfbd17d9de548ae3ca5e30928061712e0781) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x20000, CRC(d9ce58c3) SHA1(92574e60497d86b8608fba6278ccfc9036cb7f22) )
ROM_END


ROM_START( hstenn10 )
	ROM_REGION( 0x1c000, REGION_CPU1, 0 )
	ROM_LOAD( "tenbim.v10", 0x04000, 0x4000, CRC(d108a6e0) SHA1(1041e1d95b10245fc50f6484e710803db2706f9a) )
	ROM_CONTINUE(           0x10000, 0xc000 )
	ROM_COPY( REGION_CPU1, 0x14000, 0x8000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "tensnd.v1", 0x08000, 0x8000, CRC(f034a694) SHA1(3540e2edff2ce47504260ec856bab9b638d9260d) )

	ROM_REGION( 0xc0000, REGION_GFX1, 0 )
	ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(1e69ebae) SHA1(a32e2c2f4e4a527ae6b57adeccd2c4d2045ab5fe) )
	ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(4e6a22d5) SHA1(3c2d51dd874f61c0a557ea2c1968afa02d9bfc42) )
	ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(c0b643a9) SHA1(d240f703a55c39ce4a969612fbb9cd76e4b849ac) )
	ROM_LOAD( "grom3.bin", 0x60000, 0x20000, CRC(54afb456) SHA1(0a7f10b1a490825a85489ac3f678eb1e11a0ac65) )
	ROM_LOAD( "grom4.bin", 0x80000, 0x20000, CRC(ee09d645) SHA1(8233cfbd17d9de548ae3ca5e30928061712e0781) )

	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x20000, CRC(d9ce58c3) SHA1(92574e60497d86b8608fba6278ccfc9036cb7f22) )
ROM_END


ROM_START( rimrockn )
	ROM_REGION( 0x34000, REGION_CPU1, 0 )
	ROM_LOAD( "u5-2_2",    0x04000, 0x4000, CRC(97777683) SHA1(0998dde26daaa2d2b78e83647e03ba01b0ef31f2) )
	ROM_CONTINUE(          0x10000, 0x4000 )
	ROM_CONTINUE(          0x1c000, 0x4000 )
	ROM_CONTINUE(          0x28000, 0xc000 )
	ROM_CONTINUE(          0x2c000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x08000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x14000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x20000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27", 0x08000, 0x8000, CRC(59f87f0e) SHA1(46f38aca35a7c2faee227b4c950d20a6076c6fa7) )

	ROM_REGION( 0x100000, REGION_GFX1, 0 )
	ROM_LOAD( "grom00",       0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) )
	ROM_LOAD( "grom01",       0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) )
	ROM_LOAD( "grom02-2.st2", 0x80000, 0x40000, CRC(47904233) SHA1(6a4d10e8f7b75582f706a74b37d59788613ffc61) )
	ROM_LOAD( "grom03-2.st2", 0xc0000, 0x40000, CRC(f005f118) SHA1(aa39f12d07827e21eceb286557e37973e519b433) )

	ROM_REGION( 0x40000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0", 0x00000, 0x40000, CRC(7ad42be0) SHA1(c9b519bad3c5c9a3315d1bf3292cc30ee0771db7) )
ROM_END


ROM_START( rimrck20 )
	ROM_REGION( 0x34000, REGION_CPU1, 0 )
	ROM_LOAD( "rrb.bin",   0x04000, 0x4000, CRC(7e9d5545) SHA1(2aa028b3f5d05bec4ee289e7d39eaad30b3d4d5f) )
	ROM_CONTINUE(          0x10000, 0x4000 )
	ROM_CONTINUE(          0x1c000, 0x4000 )
	ROM_CONTINUE(          0x28000, 0xc000 )
	ROM_CONTINUE(          0x2c000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x08000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x14000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x20000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27", 0x08000, 0x8000, CRC(59f87f0e) SHA1(46f38aca35a7c2faee227b4c950d20a6076c6fa7) )

	ROM_REGION( 0x100000, REGION_GFX1, 0 )
	ROM_LOAD( "grom00",       0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) )
	ROM_LOAD( "grom01",       0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) )
	ROM_LOAD( "grom02-2.st2", 0x80000, 0x40000, CRC(47904233) SHA1(6a4d10e8f7b75582f706a74b37d59788613ffc61) )
	ROM_LOAD( "grom03-2.st2", 0xc0000, 0x40000, CRC(f005f118) SHA1(aa39f12d07827e21eceb286557e37973e519b433) )

	ROM_REGION( 0x40000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0", 0x00000, 0x40000, CRC(7ad42be0) SHA1(c9b519bad3c5c9a3315d1bf3292cc30ee0771db7) )
ROM_END


ROM_START( rimrck16 )
	ROM_REGION( 0x34000, REGION_CPU1, 0 )
	ROM_LOAD( "rrbbv16.u5",0x04000, 0x4000, CRC(999cd502) SHA1(8ad0d641a9f853eff27be1d4de04ab86b9275d57) )
	ROM_CONTINUE(          0x10000, 0x4000 )
	ROM_CONTINUE(          0x1c000, 0x4000 )
	ROM_CONTINUE(          0x28000, 0xc000 )
	ROM_CONTINUE(          0x2c000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x08000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x14000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x20000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "u27", 0x08000, 0x8000, CRC(59f87f0e) SHA1(46f38aca35a7c2faee227b4c950d20a6076c6fa7) )

	ROM_REGION( 0x100000, REGION_GFX1, 0 )
	ROM_LOAD( "grom00", 0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) )
	ROM_LOAD( "grom01", 0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) )
	ROM_LOAD( "grom02", 0x80000, 0x40000, CRC(34e567d5) SHA1(d0eb6fd0da8b9c3bfe7d4ecfb4bd903e4926b63a) )
	ROM_LOAD( "grom03", 0xc0000, 0x40000, CRC(fd18045d) SHA1(a1b98e4a2aa6f3cd33a3e2f5744160e05cc9f8d1) )

	ROM_REGION( 0x40000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0", 0x00000, 0x40000, CRC(7ad42be0) SHA1(c9b519bad3c5c9a3315d1bf3292cc30ee0771db7) )
ROM_END


ROM_START( rimrck12 )
	ROM_REGION( 0x34000, REGION_CPU1, 0 )
	ROM_LOAD( "rrbbv12.u5",0x04000, 0x4000, CRC(661761a6) SHA1(7224b1eac2fd0969d70657448ab241a433143df4) )
	ROM_CONTINUE(          0x10000, 0x4000 )
	ROM_CONTINUE(          0x1c000, 0x4000 )
	ROM_CONTINUE(          0x28000, 0xc000 )
	ROM_CONTINUE(          0x2c000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x08000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x14000, 0x8000 )
	ROM_COPY( REGION_CPU1, 0x2c000, 0x20000, 0x8000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "rrbsndv1.u27", 0x08000, 0x8000, CRC(8eda5f53) SHA1(f256544a8c87125587719460ed0fef14efef9015) )

	ROM_REGION( 0x100000, REGION_GFX1, 0 )
	ROM_LOAD( "grom00", 0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) )
	ROM_LOAD( "grom01", 0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) )
	ROM_LOAD( "grom02", 0x80000, 0x40000, CRC(34e567d5) SHA1(d0eb6fd0da8b9c3bfe7d4ecfb4bd903e4926b63a) )
	ROM_LOAD( "grom03", 0xc0000, 0x40000, CRC(fd18045d) SHA1(a1b98e4a2aa6f3cd33a3e2f5744160e05cc9f8d1) )

	ROM_REGION( 0x40000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0", 0x00000, 0x40000, CRC(7ad42be0) SHA1(c9b519bad3c5c9a3315d1bf3292cc30ee0771db7) )
ROM_END


ROM_START( ninclown )
	ROM_REGION( 0x80000, REGION_CPU1, 0 )
	ROM_LOAD16_BYTE( "prog1", 0x00000, 0x20000, CRC(fabfdcd2) SHA1(7a9852838cf7772d8f8f956b03823c4222520a5a) )
	ROM_LOAD16_BYTE( "prog0", 0x00001, 0x20000, CRC(eca63db5) SHA1(b86d75ee81e155a21de18c2e0fa898f15d61560d) )
	ROM_COPY(    REGION_CPU1, 0x08000, 0x40000, 0x38000 )

	ROM_REGION( 0x10000, REGION_CPU2, 0 )
	ROM_LOAD( "nc-snd", 0x08000, 0x8000, CRC(f9d5b4e1) SHA1(e5c3774db349b60baf11baecf55ac432871e612c) )

	ROM_REGION( 0x180000, REGION_GFX1, 0 )
	ROM_LOAD( "nc-grom0", 0x000000, 0x40000, CRC(532f7bff) SHA1(cc7a64ad1581f37ff4bcad78c11aad355a6e9aa8) )
	ROM_LOAD( "nc-grom1", 0x040000, 0x40000, CRC(45640d4a) SHA1(1b59ae2a74fef535c646586422f17b39c9ae247b) )
	ROM_LOAD( "nc-grom2", 0x080000, 0x40000, CRC(c8281d06) SHA1(f75d4e858f9bc19e5234f184b75818e448638c15) )
	ROM_LOAD( "nc-grom3", 0x0c0000, 0x40000, CRC(2a6d33ac) SHA1(0773a53ece0b09e7c33f0e5beb4518059f76b7af) )
	ROM_LOAD( "nc-grom4", 0x100000, 0x40000, CRC(910876ba) SHA1(d65d0a5043afe2239596ba76174a27fea60ffb35) )
	ROM_LOAD( "nc-grom5", 0x140000, 0x40000, CRC(2533279b) SHA1(c21b218b11d20f2cdac2321ffcb1334ec9ec9ffc) )

	ROM_REGION( 0x40000, REGION_SOUND1, 0 )
	ROM_LOAD( "srom0.bin", 0x00000, 0x40000, CRC(f6b501e1) SHA1(0f1eb6f40f891d11822f1255c0a84975526b2b1b) )
ROM_END



/*************************************
 *
 *	Driver-specific init
 *
 *************************************/

static DRIVER_INIT( viasound )
{
	/* some games with a YM3812 use a VIA(6522) for timing and communication */
	install_mem_read_handler (1, 0x5000, 0x500f, via6522_r);
	via6522 = install_mem_write_handler(1, 0x5000, 0x500f, via6522_w);
}


static DRIVER_INIT( slikshot )
{
	install_mem_read_handler (0, 0x0180, 0x0180, slikshot_z80_r);
	install_mem_read_handler (0, 0x01cf, 0x01cf, slikshot_z80_control_r);
	install_mem_write_handler(0, 0x01cf, 0x01cf, slikshot_z80_control_w);
}


static DRIVER_INIT( sstrike )
{
	install_mem_read_handler (0, 0x1180, 0x1180, slikshot_z80_r);
	install_mem_read_handler (0, 0x11cf, 0x11cf, slikshot_z80_control_r);
	install_mem_write_handler(0, 0x11cf, 0x11cf, slikshot_z80_control_w);
}


static DRIVER_INIT( rimrockn )
{
	/* additional input ports */
	install_mem_read_handler (0, 0x0160, 0x0160, special_port1_r);
	install_mem_read_handler (0, 0x0161, 0x0161, input_port_3_r);
	install_mem_read_handler (0, 0x0162, 0x0162, input_port_4_r);
	install_mem_read_handler (0, 0x0163, 0x0163, input_port_5_r);
	install_mem_read_handler (0, 0x0164, 0x0164, input_port_6_r);
	install_mem_read_handler (0, 0x0165, 0x0165, input_port_7_r);

	/* different banking mechanism (disable the old one) */
	install_mem_write_handler(0, 0x01a0, 0x01a0, rimrockn_bank_w);
	install_mem_write_handler(0, 0x01c0, 0x01df, itech8_blitter_w);

	/* VIA-based sound timing */
	init_viasound();
}



/*************************************
 *
 *	Game drivers
 *
 *************************************/

GAME ( 1989, wfortune, 0,        tmshi2203, wfortune, 0,        ROT0,   "GameTek", "Wheel Of Fortune" )
GAME ( 1989, wfortuna, wfortune, tmshi2203, wfortune, 0,        ROT0,   "GameTek", "Wheel Of Fortune (alternate)" )
GAME ( 1990, stratab,  0,        tmshi2203, stratab,  0,        ROT270, "Strata/Incredible Technologies", "Strata Bowling (V3)" )
GAME ( 1990, stratab1, stratab,  tmshi2203, stratab,  0,        ROT270, "Strata/Incredible Technologies", "Strata Bowling (V1)" )
GAMEX( 1990, sstrike,  0,        sstrike,   sstrike,  sstrike,  ROT270, "Strata/Incredible Technologies", "Super Strike Bowling", GAME_NOT_WORKING )
GAME ( 1990, gtg,      0,        tmshi2203, gtg,      0,        ROT0,   "Strata/Incredible Technologies", "Golden Tee Golf (Joystick, v3.1)" )
GAME ( 1990, slikshot, 0,        slikshot,  slikshot, slikshot, ROT90,  "Grand Products/Incredible Technologies", "Slick Shot (V2.2)" )
GAME ( 1990, sliksh17, slikshot, slikshot,  slikshot, slikshot, ROT90,  "Grand Products/Incredible Technologies", "Slick Shot (V1.7)" )
GAMEX( 1990, dynobop,  0,        slikshot,  dynobop,  slikshot, ROT90,  "Grand Products/Incredible Technologies", "Dyno Bop", GAME_NOT_WORKING )
GAME ( 1990, hstennis, 0,        hstennis,  hstennis, 0,        ROT90,  "Strata/Incredible Technologies", "Hot Shots Tennis (V1.1)" )
GAME ( 1990, hstenn10, hstennis, hstennis,  hstennis, 0,        ROT90,  "Strata/Incredible Technologies", "Hot Shots Tennis (V1.0)" )
GAME ( 1991, arlingtn, 0,        arlingtn,  arlingtn, 0,        ROT0,   "Strata/Incredible Technologies", "Arlington Horse Racing (v1.21-D)" )
GAME ( 1991, peggle,   0,        peggle,    peggle,   0,        ROT90,  "Strata/Incredible Technologies", "Peggle (Joystick, v1.0)" )
GAME ( 1991, pegglet,  peggle,   peggle,    pegglet,  0,        ROT90,  "Strata/Incredible Technologies", "Peggle (Trackball, v1.0)" )
GAME ( 1991, rimrockn, 0,        rimrockn,  rimrockn, rimrockn, ROT0,   "Strata/Incredible Technologies", "Rim Rockin' Basketball (V2.2)" )
GAME ( 1991, rimrck20, rimrockn, rimrockn,  rimrockn, rimrockn, ROT0,   "Strata/Incredible Technologies", "Rim Rockin' Basketball (V2.0)" )
GAME ( 1991, rimrck16, rimrockn, rimrockn,  rimrockn, rimrockn, ROT0,   "Strata/Incredible Technologies", "Rim Rockin' Basketball (V1.6)" )
GAME ( 1991, rimrck12, rimrockn, rimrockn,  rimrockn, rimrockn, ROT0,   "Strata/Incredible Technologies", "Rim Rockin' Basketball (V1.2)" )
GAME ( 1991, ninclown, 0,        ninclown,  ninclown, viasound, ROT0,   "Strata/Incredible Technologies", "Ninja Clowns (08-27-91)" )
GAME ( 1992, gpgolf,   0,        gtg2,      gpgolf,   viasound, ROT0,   "Strata/Incredible Technologies", "Golden Par Golf (Joystick, V1.1)" )
GAME ( 1992, gtg2,     0,        gtg2,      gtg2,     viasound, ROT0,   "Strata/Incredible Technologies", "Golden Tee Golf II (Trackball, V2.2)" )
GAME ( 1989, gtg2t,    gtg2,     tmshi2203, gtg2t,    0,        ROT0,   "Strata/Incredible Technologies", "Golden Tee Golf II (Trackball, V1.1)" )
GAME ( 1991, gtg2j,    gtg2,     tmslo2203, gtg,      0,        ROT0,   "Strata/Incredible Technologies", "Golden Tee Golf II (Joystick, V1.0)" )
GAME ( 1992, neckneck, 0,        neckneck,  neckneck, 0,        ROT0,   "Bundra Games/Incredible Technologies", "Neck-n-Neck (v1.2)" )
